<style>
#list td {
	border-bottom:#13B1E4 1px solid;
	border-right:#13B1E4 1px solid;}

</style>


<script type="text/javascript">
function doFilter(obj)
{
	var filter = obj.options[obj.selectedIndex].value;
	window.location = "?page=adManager&filter="+filter;
	///alert(filterId);
}

</script>
<!-- CONTENT START -->
<div id="content">

<!-- LEFT START -->
<?php
include('themes/'.$this -> theme.'/left.php');
?>
<!-- LEFT END --> 

<!-- RIGHT START -->
<div id="right">

<h2 class="right_heading">Ads Manager (Total Ads <?=$tRec?>)</h2>
<div id="shop_anounce">

<?= $this -> renderStatus($cmd)?>

<div id="paginationBar" style="width:90%; border:2px solid #ccc; margin:0 auto; text-align:right; margin-top:5px;">
<div style="float:left;">
Filter By:
	<select onchange="doFilter(this)">
    	<option value="All" <?php if($filter=="All") print "selected='selected'"?>>All (<?=$stats['All']?>)</option>
        <option value="Approved" <?php if($filter=="Approved") print "selected='selected'"?>>Approved (<?=$stats['Approved']?>)</option> 
        <option value="Rejected" <?php if($filter=="Rejected") print "selected='selected'"?>>Rejected (<?=$stats['Rejected']?>)</option>
        <option value="Pending" <?php if($filter=="Pending") print "selected='selected'"?>>Pending (<?=$stats['Pending']?>)</option>
        <option value="Featured" <?php if($filter=="Featured") print "selected='selected'"?>>Featured (<?=$stats['Featured']?>)</option>
    </select>
</div>
<?php
$prevPage=$this->makePaginationPrevious();
$nextPage=$this->makePaginationNext($tRec);
?>
<?php if($prevPage!=""): ?>
<a href="<?=$prevPage?>">&lt;&lt;Prev</a>&nbsp;
<?php endif; ?>
<?=$this->makePaginationCombo($tRec);?>&nbsp;
<?php if($nextPage!=""): ?>
<a href="<?=$nextPage?>">&gt;&gt;Next</a>&nbsp;
<?php endif; ?>
</div>

<table width="650" border="0" id="list">
  <tr>
    <td bgcolor="#CCCCCC" width="50">Id</td>
    <td bgcolor="#CCCCCC" width="80">Image</td>
    <td bgcolor="#CCCCCC" width="200">Title</td>
    <td bgcolor="#CCCCCC" width="170">Owner</td>
    <td bgcolor="#CCCCCC" width="60">Status</td>
  </tr>
  <?php
  foreach($adData as $ad): 
	  //$urlDelete = "?page=usersManager&sub=updateStatus&status=Deleted&userId=".$user['userID'];
  ?>
  <tr>
    <td><?=$ad['adID']?> <?php if($ad['isFeatured']==1):?> <span style="font-size:12px; color:red">Featured</span> <?php endif;?> </td>
    <td align="center">
    	<?php if($ad['adImg']=="") $path="images/no_image.png"; else $path="images/ads/".$ad['adImg']; ?>
    	<img src="<?=$path?>" width="70" />
    </td>
    <td><a href="?page=adminAdDetail&aid=<?=$ad['adID']?>"><?=$ad['adTitle']?></a></td>
    <td><?=$ad['adUserName']." , ".$ad['adUserEmail']?></td>
    <td><?=$ad['status']?></td>
  </tr>
  <?php
  endforeach;
  ?>
</table>

</div>
</div>
<!-- RIGHT END -->

<!-- Just to increase height automatically --><div id="height_increaser"></div>

</div>
<!-- CONTENT END -->
<div id="content_end"></div>